<?php

namespace App\Store\Validate\Goods;

use App\Common\Validate\BaseValidate;

/**
 * 商品返厂验证器
 */
class GoodsReturn extends BaseValidate
{
    //验证规则
    protected $rule = [];
    //自定义验证信息
    protected $message = [];

    public function __construct($doaction = 'add')
    {
        if ($doaction == 'del') {
            $this->rule = [
                'id' => 'required',
            ];
            $this->message = [
                'id.required' => 'id不能为空',
            ];
        }  elseif ($doaction == 'getone') {
            $this->rule = [
                'type'=>'required|in:1,2,3',
            ];
            $this->message = [
                'type.required' => '类型未选择',
                'type.in'       => '类型无效',
            ];
        }
    }
}
